package acewem.market.network;


import acewem.market.GenCo;
import acewem.market.LSE;
import sim.field.grid.*;


  public class ElGrid {
	  												/** Electricity grid space */
    private  ObjectGrid2D Space;
    												/** GenCo location at node  */
    private int GenCoAtNode;
   													/** LSE location at node */
    private int LSEAtNode;

//C-O-N-S-T-R-U-C-T-O-R------------------------------------------------------------------------     
    public ElGrid(){
		
	Space       = new  ObjectGrid2D(100, 100);
	GenCoAtNode = 0;
	LSEAtNode   = 0;
	} 

//------------------------------------------------------------------------------------------------------------------------------------------    	
/** Adds GenCos to the electricity grid */
	  public void addGenCoAtNodeK(GenCo gen, int gencoatnode){
		  
		  GenCoAtNode = gencoatnode;
		    
		  if(GenCoAtNode==1){
		      int x = (int) (0.1*100);
		      int y = (int) (0.2*100);
		      Space.set(x, y,gen);
		      //gen.setXY(x, y);		      
		    }
		    else if(GenCoAtNode==2){
		      int x = (int) (0.1*100);
		      int y = (int) (0.8*100);
		      Space.set(x,y,gen);
		      //gen.setXY(x,y);
		    }
		    else if(GenCoAtNode==3){
		      int x = (int) (0.5*100);
		      int y = (int) (0.8*100);
		      Space.set(x,y,gen);
		     // gen.setXY(x,y);
		    }
		    else if(GenCoAtNode==4){
			  int x = (int) (0.8*100);
			  int y = (int) (0.8*100);
			  Space.set(x,y,gen);
			  // gen.setXY(x,y);
			}
		    else if(GenCoAtNode==5){
			  int x = (int) (0.8*100);
			  int y = (int) (0.2*100);
			  Space.set(x,y,gen);
			  // gen.setXY(x,y);
			}
		    else{
		      System.out.println();
		    }
    }

//------------------------------------------------------------------------------------------------------------------------------------------    	
	  /** Adds LSEs to the electricity grid  */
	  public void addLSEAtNodeK(LSE lse, int lseatnode){
		  
		  LSEAtNode = lseatnode;
		    
		  if(LSEAtNode==1){
			  int x = (int) (0.1*100+1);
			  int y = (int) (0.2*100);
			  Space.set(x, y,lse);		      
			 }
			else if(LSEAtNode==2){
			  int x = (int) (0.1*100+1);
			  int y = (int) (0.8*100);
			  Space.set(x,y,lse);
			 }
			else if(LSEAtNode==3){
			  int x = (int) (0.5*100+1);
			  int y = (int) (0.8*100);
			  Space.set(x,y,lse);
			 }
		    else if(LSEAtNode==4){
			  int x = (int) (0.8*100+1);
			  int y = (int) (0.8*100);
			  Space.set(x,y,lse);
			}
		    else if(LSEAtNode==5){
			   int x = (int) (0.8*100+1);
			   int y = (int) (0.2*100);
			   Space.set(x,y,lse);
			}
			else{
			      System.out.println();
			    }
          }
 }
